﻿/** Pete's Tools package */
package pete.tools
{
	
import flash.display.DisplayObject;
import flash.display.DisplayObjectContainer;

/**
 * @version
 * 0.1
 *
 * @description 
 * Traces the structure of a display list.
 * 
 * @example
 * <pre>
 * structure( this.stage );
 * </pre>
 *
 * @param display Target DisplayObject to trace the structure of.
 * @param indent Indention formating.
 */
public function structure( display:DisplayObject, indent:String = "" ):void
{
	if ( display is DisplayObjectContainer )
	{
		var d:DisplayObjectContainer = ( display as DisplayObjectContainer );
		
		for ( var i:int = 0; i < d.numChildren; i++ )
		{
			var c:DisplayObject = d.getChildAt( i );
			trace( indent + c );
			structure( c, indent + "\t" );
		}
	}
}

}